package flc.ast.dialog;

import android.content.Context;
import android.text.TextUtils;
import android.view.Gravity;
import android.view.View;
import android.widget.ImageView;

import androidx.annotation.NonNull;

import com.blankj.utilcode.util.ConvertUtils;
import com.blankj.utilcode.util.ToastUtils;
import com.bumptech.glide.Glide;
import com.stark.picselect.entity.SelectMediaEntity;

import java.util.ArrayList;
import java.util.List;

import flc.ast.R;
import flc.ast.databinding.DialogEditStyleBinding;
import flc.ast.utils.AppSpUtils;
import stark.common.basic.base.BaseSmartDialog;
import stark.common.basic.utils.TimeUtil;

public class EditDialog extends BaseSmartDialog<DialogEditStyleBinding> implements View.OnClickListener {

    public String hint;

    public EditDialog(@NonNull Context context) {
        super(context);
    }

    @Override
    protected boolean canceledOnTouchOutside() {
        return true;
    }

    @Override
    protected int getGravity() {
        return Gravity.BOTTOM;
    }

    @Override
    protected int getLayoutId() {
        return R.layout.dialog_edit_style;
    }

    @Override
    protected void initView(View view) {
        if (!TextUtils.isEmpty(hint)) {
            mDataBinding.tvFolder.setText(hint);
        }
        mDataBinding.tvRename.setOnClickListener(this);
        mDataBinding.tvShare.setOnClickListener(this);
        mDataBinding.tvFolder.setOnClickListener(this);
        mDataBinding.tvInfo.setOnClickListener(this);
        mDataBinding.tvDelete.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.tvRename:
                dismiss();
                if (listener != null) {
                    listener.clickRename();
                }
                break;
            case R.id.tvShare:
                dismiss();
                if (listener != null) {
                    listener.clickShare();
                }
                break;
            case R.id.tvFolder:
                dismiss();
                if (listener != null) {
                    listener.clickAddFolder();
                }
                break;
            case R.id.tvInfo:
                dismiss();
                if (listener != null) {
                    listener.clickInfo();
                }
                break;
            case R.id.tvDelete:
                dismiss();
                if (listener != null) {
                    listener.clickDelete();
                }
                break;
            default:
                break;
        }
    }

    private Ilistener listener;

    public void setListener(Ilistener listener) {
        this.listener = listener;
    }

    public interface Ilistener {
        void clickRename();

        void clickShare();

        void clickAddFolder();

        void clickInfo();

        void clickDelete();
    }
}
